<include file="__THEME__/public_header" />
	<div id="page-wrap">
		<div class="reg-wrap">	
			<div class="reg-main">
				<neq name='config.register_type' value='closed'>
				<!--注册步骤-->
				<form model-node="normal_form" method="POST" action="{:U('public/Register/doStep1')}" name="ajax_register_form" id="ajax_register_form">
				<input type="hidden" name="invate" value="{$is_invite}" />
				<input type="hidden" name="invate_key" value="{$invite_code}" />
				<div class="article boxShadow">
					<div class="title">{:L('PUBLIC_REGISTER_ACCOUNT')}</div>
					<php>if($is_invite):</php>
					<div class="user-info">
						<img src="{$inviteInfo.avatar_small}" width="30" height="30"/>Hi，我是{$inviteInfo.uname}，邀请你加入这里，随时分享我的最新动态。
					</div>
					<php>endif;</php>
					<dl class="item">
						<dd>
							<div class="form-tt"><i class="text-required">*</i>手机号：</div>
							<div class="form-row" style="z-index:99">
								<input class="s-txt mobile" name="mobile" type="text" value="" />
								<div style="" class="box-ver aw-note">
								
								</div>
							</div>
						</dd>
						<!-- <dd>
							<div class="form-tt"><i class="text-required">*</i>{:L('PUBLIC_LOGIN_EMAIL')}：</div>
							<div class="form-row" style="z-index:99">
								<input event-node="email" event-args="suffix={$config['email_suffix']}" name="email" checkurl="{:U('public/Register/isEmailAvailable')}" autocomplete="off" type="text" value="" />
							</div>
						</dd> -->
						<dd>
							<div class="form-tt"><i class="text-required">*</i>{:L('PUBLIC_LOGIN_PASSWORD')}：</div>
							<div class="form-row psd">
                            	<div style="overflow:hidden;*zoom:1">
                                    <input event-node="password" name="password" type="password" value=""/>
                                    <div model-node="password_weight" class="psw-state-empty">
                                        <div class="progress progress-green-transition"><div class="bar"></div></div>
                                        <div class="txt"><span>{:L('PUBLIC_PASSWORD_WEAK')}</span><span>{:L('PUBLIC_PASSWORD_MIDDLE')}</span><span>{:L('PUBLIC_PASSWORD_STRONG')}</span></div>
                                    </div>
                                </div>
                                <div class="txt-info">密码由字母，数字，符号组成，6-15个字符，区分大小写</div>
							</div>
						</dd>
						<dd>
							<div class="form-tt"><i class="text-required">*</i>{:L('PUBLIC_CONFIRM_PASSWORD')}：</div>
							<div class="form-row">
								<input event-node="repassword" name="repassword" type="password" />
							</div>
						</dd>
						<dd>
							<div class="form-tt"><i class="text-required">*</i>{:L('PUBLIC_NICKNAME')}：</div>
							<div class="form-row">
								<div style="overflow:hidden;*zoom:1">
                                <input event-node="uname" name="uname" checkurl="{:U('public/Register/isUnameAvailable')}" autocomplete="off" type="text" value="" />
                                </div>
								<div event-node="uname_tips" class="txt-info">{:L('PUBLIC_NICKNAME_TIPS', array('nums'=>'2-10'))}</div>
							</div>
						</dd>
						<dd>
							<div class="form-tt"><i class="text-required">*</i>{:L('PUBLIC_GENDER')}：</div>
							<div class="form-row">
								<label><input name="sex" type="radio" class="s-radio" value="1" checked="checked" event-node="radio" event-args="error={:L('PUBLIC_CHOOSE_GENDER')}" />{:L('PUBLIC_MALE')}</label>
								<label><input event-node="radio" type="radio" name="sex" value="2" class="s-radio"  />{:L('PUBLIC_FEMALE')}</label>
							</div>
						</dd>
						<!-- <dd>
							<div class="form-tt"><i class="text-required">*</i>地区：</div>
							<div class="form-row">
								<div style="padding:3px 0 0 0;*height:30px;overflow:hidden;*zoom:1;">
								{:W('Area',array('curPro'=>0,'curCity'=>0,'area'=>0,'tpl'=>'selectArea'))}
								</div>
							</div>
						</dd> -->
													<dd>
							<div class="form-tt"><i class="text-required">*</i>验证码：</div>
							<div class="form-row">
								<div class="captcha-tips" style="padding:3px 0 0 0;*height:30px;overflow:hidden;*zoom:1;">
									<input name="verify" type="text" class="s-txt" style="width:70px" />
									<input type="button" value="点击获取验证码" class="send-msg" />
									<!-- <img src="__ROOT__/public/captcha.php" id="verifyimg" class="alM" onclick="change_verify()" />
									<a href="###" onclick="change_verify()" alt="换一张">看不清楚，换一个</a> -->
								</div>
							</div>
						</dd>
						<dd class="mt15">
							<div class="form-tt"></div>
							<div class="form-row actionBtn">
								<a class="btn-register" href="javascript:;" onclick="$('#ajax_register_form').submit();return false;">{:L('PUBLIC_REGISTER_NOW')}</a>
							</div>
						</dd>
					</dl>
				</div>
				</form>
				<else />
				 <div class="item-find-psd"><neq name='config.register_close' value=''>{$config.register_close}</neq></div>
				</neq>
			</div>
		</div>
    </div>
<script>
function change_verify(){
	var date = new Date();
	var ttime = date.getTime();
	var url = SITE_URL+'/public/captcha.php';
	$('#verifyimg').attr('src',url+'?'+ttime);
}

function is_phone(value) {
    return value.match(/^13[0-9]{9}$|14[0-9]{9}|15[0-9]{9}$|18[0-9]{9}$/);
}

$(function(){
	$(".mobile").blur(function(){
		var data = $(this).val();
		var othis = $(this);

		if(data == ''){
			othis.next('.aw-note').html('<span><b class="ico-error"></b>手机号码不能为空</span>');
			return false;
		}

		if(!is_phone(data)){
			othis.next('.aw-note').html('<span><b class="ico-error"></b>手机号码格式不正确</span>');
			return false;
		}

		$.post("{:U('public/Register/isMobileAvailable')}",{mobile:data},function(res){
			if(res.status == 0){
				othis.next('.aw-note').html('<span><b class="ico-error"></b>'+ res.info +'</span>');
			}else{
				othis.next('.aw-note').html('');
			}
		},"JSON");
	});

	var util = {
        wait: 60,
        hsTime: function (obj) {
            var _this = this;
            if (_this.wait <= 0) {
                $(obj).removeAttr("disabled").val('重发短信验证码');
                _this.wait = 60;
            } else {
                $(obj).attr("disabled", true).val('在' + _this.wait + '秒后点此重发');
                _this.wait--;
                setTimeout(function () {
                    _this.hsTime(obj);
                }, 1000)
            }
        }
    }

    $('.send-msg').click(function(){
    	var mobile = $('.mobile').val();
        util.hsTime('.send-msg');

        $.get("{:U('public/Register/sendMsgCode')}",{mobile:mobile},function(res){
            alert(res.info);
        },"JSON");
        
    });
})

</script>
<script src="__THEME__/js/module.form.js"></script>
<include file="__THEME__/public_footer" />